package com.shishuo.cms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shishuo.cms.dao.CashDao;
import com.shishuo.cms.entity.CashEntity;
import com.shishuo.cms.entity.vo.PageVo;

@Service
public class CashService  extends BaseService<CashEntity, Long> {
	private CashDao cashDao;

	@Autowired
	public void setCashDao(CashDao cashDao) {
		super.setBaseDao(cashDao);
		this.cashDao = cashDao;
	}

	public PageVo<CashEntity> getAllListPage(int pageNum,long userId) throws Exception {
		PageVo<CashEntity> pageVo = new PageVo<CashEntity>(pageNum);
		List<CashEntity> list =cashDao.getAllList(pageNum*10,(long)10,userId);
		pageVo.setList(list);
		pageVo.setCount(cashDao.getAllListCount(userId));
		return pageVo;
	}
	/**
	 * 用户充值提交
	 * @param id
	 * @param inputMoney
	 */
	public void inputMoney(long userId, double inputMoney) {
		CashEntity cashEntity=new CashEntity();
		cashEntity.setUserId(userId);
		cashEntity.setCashCount(inputMoney);
		cashEntity.setCashMsg("用户充值!");
		cashDao.add(cashEntity);
	}

	
}
